home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / locimpl.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  3.3 KB  |  90 lines

  1. #ifndef __LOCIMPL_CC
  2. #define __LOCIMPL_CC
  3. #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
  4.  
  5. /***************************************************************************
  6.  *
  7.  * rw/locimpl.cc - Template definitions for the Standard Library locale
  8.  *                 private implementation classes.
  9.  *
  10.  * $Id: locimpl.cc,v 1.17 1996/10/02 01:48:00 smithey Exp $
  11.  *
  12.  ***************************************************************************
  13.  *
  14.  * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
  15.  * ALL RIGHTS RESERVED *
  16.  * The software and information contained herein are proprietary to, and
  17.  * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
  18.  * intends to preserve as trade secrets such software and information.
  19.  * This software is furnished pursuant to a written license agreement and
  20.  * may be used, copied, transmitted, and stored only in accordance with
  21.  * the terms of such license and with the inclusion of the above copyright
  22.  * notice.  This software and information or any other copies thereof may
  23.  * not be provided or otherwise made available to any other person.
  24.  *
  25.  * Notwithstanding any other lease or license that may pertain to, or
  26.  * accompany the delivery of, this computer software and information, the
  27.  * rights of the Government regarding its use, reproduction and disclosure
  28.  * are as set forth in Section 52.227-19 of the FARS Computer
  29.  * Software-Restricted Rights clause.
  30.  * 
  31.  * Use, duplication, or disclosure by the Government is subject to
  32.  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  33.  * Technical Data and Computer Software clause at DFARS 252.227-7013.
  34.  * Contractor/Manufacturer is Rogue Wave Software, Inc.,
  35.  * P.O. Box 2328, Corvallis, Oregon 97339.
  36.  *
  37.  * This computer software and information is distributed with "restricted
  38.  * rights."  Use, duplication or disclosure is subject to restrictions as
  39.  * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
  40.  * Computer Software-Restricted Rights (April 1985)."  If the Clause at
  41.  * 18-52.227-74 "Rights in Data General" is specified in the contract,
  42.  * then the "Alternate III" clause applies.
  43.  *
  44.  **************************************************************************/
  45.  
  46. #ifndef _RWSTD_NO_NAMESPACE
  47. namespace __rwstd {
  48. #endif
  49.  
  50. // -------------------------------------------
  51. // Template digit_map<charT> member templates.
  52. // -------------------------------------------
  53.  
  54. template <class charT>
  55. void 
  56. digit_map<charT>::init (const ctype<charT> &ct)
  57. {
  58.   ct.widen(punct_chars,punct_chars+sizeof punct_chars,punct_array);
  59.   ct.widen(digit_chars,digit_chars+sizeof digit_chars,digit_array);
  60.   memcpy(value_array,char_values,sizeof value_array);
  61.   inited=true;
  62. }
  63.  
  64. template <class charT>
  65. const digit_map<charT>&
  66. digit_map<charT>::get_digit_map (const ctype<charT>& ct)
  67. {
  68.   if (!ct.digit_map_.inited)
  69.     (_RWSTD_CONST_CAST(digit_map<char_type>&,ct.digit_map_))
  70.         .init(ct);
  71.   return ct.digit_map_;
  72. }
  73.  
  74. template <class charT>
  75. int digit_map<charT>::eval (charT c) const {
  76.   const charT *end=digit_array+sizeof value_array;
  77.   for (const charT *p=digit_array; p<end; p++)
  78.     if (*p==c)
  79.       return value_array[p-digit_array];
  80.   return -1;
  81. }
  82.  
  83.  
  84. #ifndef _RWSTD_NO_NAMESPACE
  85. } // namespace __rwstd
  86. #endif
  87.  
  88. #pragma option pop
  89. #endif /* __LOCIMPL_CC */
  90.